-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Part 2 #10
base: part-1
Are you sure you want to change the base?
Conversation
Add util for spawning bundles
…undyra into patryk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generalnie bardzo ładnie, widać że dużo pracy w to włożyliście. Jest parę rzeczy do poprawki jeszcze.
src/game/audio.rs
Outdated
) { | ||
audio_event.iter().for_each(|_| { | ||
let mut rng = thread_rng(); | ||
match rng.gen_range(0..100) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a to nie prościej zrobić losowanie od 1 do 3? (czy tam od 0 do 2)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Zdecydowanie prościej...
src/game/audio.rs
Outdated
}); | ||
} | ||
|
||
pub fn play_fast_shoot_sfx( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, no powtarza się ten kod, ale nie wiem, czy bez makr dałoby się to jakoś lepiej zrobić...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
o, wiem! może event mógłby mieć po prostu parametr oznaczający rodzaj dźwięku - i wtedy wszystko w jednym systemie dałoby się ogarnąć
src/game/map.rs
Outdated
// Add colliders for the whole map as big rectangles | ||
fn add_colliders(world: &[(i32, usize)], commands: &mut Commands) { | ||
let (mut block_start, mut current_height) = | ||
world.first().map(|&(x, y)| (x, y)).unwrap_or((0, 0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chyba można zamiast tego map
użyć copied
@@ -62,3 +72,21 @@ fn cleanup_all(mut commands: Commands, query: Query<Entity>) { | |||
commands.entity(entity).despawn_recursive(); | |||
} | |||
} | |||
|
|||
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) { | |||
commands.insert_resource(GameTextures { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
czy to to wczytywanie tyle czasu zajmuje?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh, a może to dźwięki? pewnie dałoby się to jakoś sparalelizować
src/game/monster.rs
Outdated
(Ok(_), _) | (_, Ok(_)) => match ( | ||
enemy_bullets.get(*ent1), | ||
enemy_bullets.get(*ent2), | ||
enemies.get(*ent1), | ||
enemies.get(*ent2), | ||
) { | ||
(Ok(_), _, _, _) | (_, Ok(_), _, _) | (_, _, Ok(_), _) | (_, _, _, Ok(_)) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, niezbyt piękny jest ten kod
src/game/powerups.rs
Outdated
for collision_event in collision_events.iter() { | ||
if let CollisionEvent::Started(ent1, ent2, _) = collision_event { | ||
match ( | ||
players.get(*ent1), | ||
rusts.get(*ent2), | ||
players.get(*ent2), | ||
rusts.get(*ent1), | ||
) { | ||
(Ok(_), Ok(rust), _, _) | (_, _, Ok(_), Ok(rust)) => { | ||
send_event.send(RustEvent { rust }); | ||
} | ||
_ => {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kurczę, taki schemacik też się dużo razy powtarza
src/game/powerups.rs
Outdated
if should_add_coffee(x, rng, level) { | ||
spawn_coffee(commands, &game_textures, x as f32, height as f32 + 0.75); | ||
} | ||
if should_add_rust(x, rng, level) { | ||
spawn_rust(commands, &game_textures, x as f32, height as f32 + 0.75); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if should_add_coffee(x, rng, level) { | |
spawn_coffee(commands, &game_textures, x as f32, height as f32 + 0.75); | |
} | |
if should_add_rust(x, rng, level) { | |
spawn_rust(commands, &game_textures, x as f32, height as f32 + 0.75); | |
} | |
let y = height as f32 + 0.75; | |
if should_add_coffee(x, rng, level) { | |
spawn_coffee(commands, &game_textures, x as f32, y); | |
} | |
if should_add_rust(x, rng, level) { | |
spawn_rust(commands, &game_textures, x as f32, y); | |
} |
src/game/utils.rs
Outdated
(x_size, y_size): (f32, f32), | ||
(x_translation, y_translation, z_translation): (f32, f32, f32), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chyba lepsze byłyby dedykowane structy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ale bez presji
Co-authored-by: Andrzej Głuszak <[email protected]>
* Cleaner rng in audio * Fix few things from review * Refactor audio events system and change some names * Refactor strange match statements * Add resuming game Co-authored-by: Patryk Bundyra <[email protected]>
# Conflicts: # src/game/audio.rs # src/game/player.rs
A more generic audio plugin, resolving a bug with jumping, resolving a bug with bullets flying beyond the map
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Raz prawie doszedłem do trzeciego poziomu i gra się scrashowała :(
thread 'main' panicked at 'proxy.aabb.maxs 49.679996 (in AABB { mins: [49.677998, 25.861479], maxs: [49.679996, 25.863478] }) >= min_bound 49.68', /home/agluszak/.cargo/registry/src/github.com-1ecc6299db9ec823/rapier2d-0.12.0/src/geometry/broad_phase_multi_sap/sap_axis.rs:61:13
Czasami lecą mi dwie piosenki na raz
Zmiany w kodzie na plus!
Gdybyście chcieli rozwijać to jeszcze kiedyś to ciekawym featurem byłoby żeby dźwięk leciał tym bardziej z lewego głośnika im bardziej po lewej jest źródło dźwięku
5/5
No description provided.